<div id="name"></div>
<script>
    // console.log('..........');
    axios.get('/userInfo')
        .then(res => {
            if (res.data.code == 401) {
                window.location.href = '/login'
            }
            if (res.data.code == 200) {
                const { user } = res.data.user
                // console.log(user, '//////');
                document.getElementById('name').innerHTML = user.name
                document.getElementById('age').innerHTML = user.age
            }
            // console.log(res);
        })
</script>